3.7.48 \(\int (a+b \sec (c+d x))^2 (A+C \sec ^2(c+d x)) \, dx\) [648]

Optimal. Leaf size=103 \[ a^2 A x+\frac {a b (2 A+C) \tanh ^{-1}(\sin (c+d x))}{d}+\frac {\left (3 A b^2+2 \left (a^2+b^2\right ) C\right ) \tan (c+d x)}{3 d}+\frac {a b C \sec (c+d x) \tan (c+d x)}{3 d}+\frac {C (a+b \sec (c+d x))^2 \tan (c+d x)}{3 d} \]

[Out]

a^2*A*x+a*b*(2*A+C)*arctanh(sin(d*x+c))/d+1/3*(3*A*b^2+2*(a^2+b^2)*C)*tan(d*x+c)/d+1/3*a*b*C*sec(d*x+c)*tan(d*
x+c)/d+1/3*C*(a+b*sec(d*x+c))^2*tan(d*x+c)/d

________________________________________________________________________________________

Rubi [A]
time = 0.10, antiderivative size = 103, normalized size of antiderivative = 1.00, number of steps used = 6, number of rules used = 5, integrand size = 25, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.200, Rules used = {4142, 4133, 3855, 3852, 8} \begin {gather*} \frac {\left (2 C \left (a^2+b^2\right )+3 A b^2\right ) \tan (c+d x)}{3 d}+a^2 A x+\frac {a b (2 A+C) \tanh ^{-1}(\sin (c+d x))}{d}+\frac {a b C \tan (c+d x) \sec (c+d x)}{3 d}+\frac {C \tan (c+d x) (a+b \sec (c+d x))^2}{3 d} \end {gather*}

Antiderivative was successfully verified.

[In]

Int[(a + b*Sec[c + d*x])^2*(A + C*Sec[c + d*x]^2),x]

[Out]

a^2*A*x + (a*b*(2*A + C)*ArcTanh[Sin[c + d*x]])/d + ((3*A*b^2 + 2*(a^2 + b^2)*C)*Tan[c + d*x])/(3*d) + (a*b*C*
Sec[c + d*x]*Tan[c + d*x])/(3*d) + (C*(a + b*Sec[c + d*x])^2*Tan[c + d*x])/(3*d)

Rule 8

Int[a_, x_Symbol] :> Simp[a*x, x] /; FreeQ[a, x]

Rule 3852

Int[csc[(c_.) + (d_.)*(x_)]^(n_), x_Symbol] :> Dist[-d^(-1), Subst[Int[ExpandIntegrand[(1 + x^2)^(n/2 - 1), x]
, x], x, Cot[c + d*x]], x] /; FreeQ[{c, d}, x] && IGtQ[n/2, 0]

Rule 3855

Int[csc[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-ArcTanh[Cos[c + d*x]]/d, x] /; FreeQ[{c, d}, x]

Rule 4133

Int[((A_.) + csc[(e_.) + (f_.)*(x_)]*(B_.) + csc[(e_.) + (f_.)*(x_)]^2*(C_.))*(csc[(e_.) + (f_.)*(x_)]*(b_.) +
 (a_)), x_Symbol] :> Simp[(-b)*C*Csc[e + f*x]*(Cot[e + f*x]/(2*f)), x] + Dist[1/2, Int[Simp[2*A*a + (2*B*a + b
*(2*A + C))*Csc[e + f*x] + 2*(a*C + B*b)*Csc[e + f*x]^2, x], x], x] /; FreeQ[{a, b, e, f, A, B, C}, x]

Rule 4142

Int[((A_.) + csc[(e_.) + (f_.)*(x_)]^2*(C_.))*(csc[(e_.) + (f_.)*(x_)]*(b_.) + (a_))^(m_.), x_Symbol] :> Simp[
(-C)*Cot[e + f*x]*((a + b*Csc[e + f*x])^m/(f*(m + 1))), x] + Dist[1/(m + 1), Int[(a + b*Csc[e + f*x])^(m - 1)*
Simp[a*A*(m + 1) + (A*b*(m + 1) + b*C*m)*Csc[e + f*x] + a*C*m*Csc[e + f*x]^2, x], x], x] /; FreeQ[{a, b, e, f,
 A, C}, x] && NeQ[a^2 - b^2, 0] && IGtQ[2*m, 0]

Rubi steps

\begin {align*} \int (a+b \sec (c+d x))^2 \left (A+C \sec ^2(c+d x)\right ) \, dx &=\frac {C (a+b \sec (c+d x))^2 \tan (c+d x)}{3 d}+\frac {1}{3} \int (a+b \sec (c+d x)) \left (3 a A+b (3 A+2 C) \sec (c+d x)+2 a C \sec ^2(c+d x)\right ) \, dx\\ &=\frac {a b C \sec (c+d x) \tan (c+d x)}{3 d}+\frac {C (a+b \sec (c+d x))^2 \tan (c+d x)}{3 d}+\frac {1}{6} \int \left (6 a^2 A+6 a b (2 A+C) \sec (c+d x)+2 \left (3 A b^2+2 \left (a^2+b^2\right ) C\right ) \sec ^2(c+d x)\right ) \, dx\\ &=a^2 A x+\frac {a b C \sec (c+d x) \tan (c+d x)}{3 d}+\frac {C (a+b \sec (c+d x))^2 \tan (c+d x)}{3 d}+(a b (2 A+C)) \int \sec (c+d x) \, dx+\frac {1}{3} \left (3 A b^2+2 \left (a^2+b^2\right ) C\right ) \int \sec ^2(c+d x) \, dx\\ &=a^2 A x+\frac {a b (2 A+C) \tanh ^{-1}(\sin (c+d x))}{d}+\frac {a b C \sec (c+d x) \tan (c+d x)}{3 d}+\frac {C (a+b \sec (c+d x))^2 \tan (c+d x)}{3 d}-\frac {\left (3 A b^2+2 \left (a^2+b^2\right ) C\right ) \text {Subst}(\int 1 \, dx,x,-\tan (c+d x))}{3 d}\\ &=a^2 A x+\frac {a b (2 A+C) \tanh ^{-1}(\sin (c+d x))}{d}+\frac {\left (3 A b^2+2 \left (a^2+b^2\right ) C\right ) \tan (c+d x)}{3 d}+\frac {a b C \sec (c+d x) \tan (c+d x)}{3 d}+\frac {C (a+b \sec (c+d x))^2 \tan (c+d x)}{3 d}\\ \end {align*}

________________________________________________________________________________________

Mathematica [B] Leaf count is larger than twice the leaf count of optimal. \(242\) vs. \(2(103)=206\).
time = 1.29, size = 242, normalized size = 2.35 \begin {gather*} \frac {\sec ^3(c+d x) \left (9 a \cos (c+d x) \left (a A (c+d x)-b (2 A+C) \log \left (\cos \left (\frac {1}{2} (c+d x)\right )-\sin \left (\frac {1}{2} (c+d x)\right )\right )+b (2 A+C) \log \left (\cos \left (\frac {1}{2} (c+d x)\right )+\sin \left (\frac {1}{2} (c+d x)\right )\right )\right )+3 a \cos (3 (c+d x)) \left (a A (c+d x)-b (2 A+C) \log \left (\cos \left (\frac {1}{2} (c+d x)\right )-\sin \left (\frac {1}{2} (c+d x)\right )\right )+b (2 A+C) \log \left (\cos \left (\frac {1}{2} (c+d x)\right )+\sin \left (\frac {1}{2} (c+d x)\right )\right )\right )+2 \left (3 A b^2+3 a^2 C+4 b^2 C+6 a b C \cos (c+d x)+\left (3 A b^2+3 a^2 C+2 b^2 C\right ) \cos (2 (c+d x))\right ) \sin (c+d x)\right )}{12 d} \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[(a + b*Sec[c + d*x])^2*(A + C*Sec[c + d*x]^2),x]

[Out]

(Sec[c + d*x]^3*(9*a*Cos[c + d*x]*(a*A*(c + d*x) - b*(2*A + C)*Log[Cos[(c + d*x)/2] - Sin[(c + d*x)/2]] + b*(2
*A + C)*Log[Cos[(c + d*x)/2] + Sin[(c + d*x)/2]]) + 3*a*Cos[3*(c + d*x)]*(a*A*(c + d*x) - b*(2*A + C)*Log[Cos[
(c + d*x)/2] - Sin[(c + d*x)/2]] + b*(2*A + C)*Log[Cos[(c + d*x)/2] + Sin[(c + d*x)/2]]) + 2*(3*A*b^2 + 3*a^2*
C + 4*b^2*C + 6*a*b*C*Cos[c + d*x] + (3*A*b^2 + 3*a^2*C + 2*b^2*C)*Cos[2*(c + d*x)])*Sin[c + d*x]))/(12*d)

________________________________________________________________________________________

Maple [A]
time = 0.09, size = 117, normalized size = 1.14

method result size
derivativedivides \(\frac {A \,b^{2} \tan \left (d x +c \right )-b^{2} C \left (-\frac {2}{3}-\frac {\left (\sec ^{2}\left (d x +c \right )\right )}{3}\right ) \tan \left (d x +c \right )+2 a A b \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )+2 a b C \left (\frac {\sec \left (d x +c \right ) \tan \left (d x +c \right )}{2}+\frac {\ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )}{2}\right )+A \,a^{2} \left (d x +c \right )+a^{2} C \tan \left (d x +c \right )}{d}\) \(117\)
default \(\frac {A \,b^{2} \tan \left (d x +c \right )-b^{2} C \left (-\frac {2}{3}-\frac {\left (\sec ^{2}\left (d x +c \right )\right )}{3}\right ) \tan \left (d x +c \right )+2 a A b \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )+2 a b C \left (\frac {\sec \left (d x +c \right ) \tan \left (d x +c \right )}{2}+\frac {\ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )}{2}\right )+A \,a^{2} \left (d x +c \right )+a^{2} C \tan \left (d x +c \right )}{d}\) \(117\)
norman \(\frac {a^{2} A x \left (\tan ^{6}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )-a^{2} A x +\frac {4 \left (3 A \,b^{2}+3 a^{2} C +b^{2} C \right ) \left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{3 d}-\frac {2 \left (A \,b^{2}+a^{2} C -a b C +b^{2} C \right ) \left (\tan ^{5}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d}-\frac {2 \left (A \,b^{2}+a^{2} C +a b C +b^{2} C \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{d}+3 a^{2} A x \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )-3 a^{2} A x \left (\tan ^{4}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{\left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )^{3}}+\frac {a b \left (2 A +C \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}{d}-\frac {a b \left (2 A +C \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}{d}\) \(231\)
risch \(a^{2} A x -\frac {2 i \left (3 C a b \,{\mathrm e}^{5 i \left (d x +c \right )}-3 A \,b^{2} {\mathrm e}^{4 i \left (d x +c \right )}-3 C \,a^{2} {\mathrm e}^{4 i \left (d x +c \right )}-6 A \,b^{2} {\mathrm e}^{2 i \left (d x +c \right )}-6 C \,a^{2} {\mathrm e}^{2 i \left (d x +c \right )}-6 C \,b^{2} {\mathrm e}^{2 i \left (d x +c \right )}-3 C b a \,{\mathrm e}^{i \left (d x +c \right )}-3 A \,b^{2}-3 a^{2} C -2 b^{2} C \right )}{3 d \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )^{3}}+\frac {2 b a \ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) A}{d}+\frac {b a \ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) C}{d}-\frac {2 b a \ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) A}{d}-\frac {b a \ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) C}{d}\) \(232\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((a+b*sec(d*x+c))^2*(A+C*sec(d*x+c)^2),x,method=_RETURNVERBOSE)

[Out]

1/d*(A*b^2*tan(d*x+c)-b^2*C*(-2/3-1/3*sec(d*x+c)^2)*tan(d*x+c)+2*a*A*b*ln(sec(d*x+c)+tan(d*x+c))+2*a*b*C*(1/2*
sec(d*x+c)*tan(d*x+c)+1/2*ln(sec(d*x+c)+tan(d*x+c)))+A*a^2*(d*x+c)+a^2*C*tan(d*x+c))

________________________________________________________________________________________

Maxima [A]
time = 0.30, size = 129, normalized size = 1.25 \begin {gather*} \frac {6 \, {\left (d x + c\right )} A a^{2} + 2 \, {\left (\tan \left (d x + c\right )^{3} + 3 \, \tan \left (d x + c\right )\right )} C b^{2} - 3 \, C a b {\left (\frac {2 \, \sin \left (d x + c\right )}{\sin \left (d x + c\right )^{2} - 1} - \log \left (\sin \left (d x + c\right ) + 1\right ) + \log \left (\sin \left (d x + c\right ) - 1\right )\right )} + 12 \, A a b \log \left (\sec \left (d x + c\right ) + \tan \left (d x + c\right )\right ) + 6 \, C a^{2} \tan \left (d x + c\right ) + 6 \, A b^{2} \tan \left (d x + c\right )}{6 \, d} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*sec(d*x+c))^2*(A+C*sec(d*x+c)^2),x, algorithm="maxima")

[Out]

1/6*(6*(d*x + c)*A*a^2 + 2*(tan(d*x + c)^3 + 3*tan(d*x + c))*C*b^2 - 3*C*a*b*(2*sin(d*x + c)/(sin(d*x + c)^2 -
 1) - log(sin(d*x + c) + 1) + log(sin(d*x + c) - 1)) + 12*A*a*b*log(sec(d*x + c) + tan(d*x + c)) + 6*C*a^2*tan
(d*x + c) + 6*A*b^2*tan(d*x + c))/d

________________________________________________________________________________________

Fricas [A]
time = 2.12, size = 136, normalized size = 1.32 \begin {gather*} \frac {6 \, A a^{2} d x \cos \left (d x + c\right )^{3} + 3 \, {\left (2 \, A + C\right )} a b \cos \left (d x + c\right )^{3} \log \left (\sin \left (d x + c\right ) + 1\right ) - 3 \, {\left (2 \, A + C\right )} a b \cos \left (d x + c\right )^{3} \log \left (-\sin \left (d x + c\right ) + 1\right ) + 2 \, {\left (3 \, C a b \cos \left (d x + c\right ) + C b^{2} + {\left (3 \, C a^{2} + {\left (3 \, A + 2 \, C\right )} b^{2}\right )} \cos \left (d x + c\right )^{2}\right )} \sin \left (d x + c\right )}{6 \, d \cos \left (d x + c\right )^{3}} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*sec(d*x+c))^2*(A+C*sec(d*x+c)^2),x, algorithm="fricas")

[Out]

1/6*(6*A*a^2*d*x*cos(d*x + c)^3 + 3*(2*A + C)*a*b*cos(d*x + c)^3*log(sin(d*x + c) + 1) - 3*(2*A + C)*a*b*cos(d
*x + c)^3*log(-sin(d*x + c) + 1) + 2*(3*C*a*b*cos(d*x + c) + C*b^2 + (3*C*a^2 + (3*A + 2*C)*b^2)*cos(d*x + c)^
2)*sin(d*x + c))/(d*cos(d*x + c)^3)

________________________________________________________________________________________

Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \int \left (A + C \sec ^{2}{\left (c + d x \right )}\right ) \left (a + b \sec {\left (c + d x \right )}\right )^{2}\, dx \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*sec(d*x+c))**2*(A+C*sec(d*x+c)**2),x)

[Out]

Integral((A + C*sec(c + d*x)**2)*(a + b*sec(c + d*x))**2, x)

________________________________________________________________________________________

Giac [B] Leaf count of result is larger than twice the leaf count of optimal. 262 vs. \(2 (97) = 194\).
time = 0.50, size = 262, normalized size = 2.54 \begin {gather*} \frac {3 \, {\left (d x + c\right )} A a^{2} + 3 \, {\left (2 \, A a b + C a b\right )} \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 1 \right |}\right ) - 3 \, {\left (2 \, A a b + C a b\right )} \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 1 \right |}\right ) - \frac {2 \, {\left (3 \, C a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} - 3 \, C a b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} + 3 \, A b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} + 3 \, C b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} - 6 \, C a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - 6 \, A b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - 2 \, C b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + 3 \, C a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 3 \, C a b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 3 \, A b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 3 \, C b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )\right )}}{{\left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 1\right )}^{3}}}{3 \, d} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*sec(d*x+c))^2*(A+C*sec(d*x+c)^2),x, algorithm="giac")

[Out]

1/3*(3*(d*x + c)*A*a^2 + 3*(2*A*a*b + C*a*b)*log(abs(tan(1/2*d*x + 1/2*c) + 1)) - 3*(2*A*a*b + C*a*b)*log(abs(
tan(1/2*d*x + 1/2*c) - 1)) - 2*(3*C*a^2*tan(1/2*d*x + 1/2*c)^5 - 3*C*a*b*tan(1/2*d*x + 1/2*c)^5 + 3*A*b^2*tan(
1/2*d*x + 1/2*c)^5 + 3*C*b^2*tan(1/2*d*x + 1/2*c)^5 - 6*C*a^2*tan(1/2*d*x + 1/2*c)^3 - 6*A*b^2*tan(1/2*d*x + 1
/2*c)^3 - 2*C*b^2*tan(1/2*d*x + 1/2*c)^3 + 3*C*a^2*tan(1/2*d*x + 1/2*c) + 3*C*a*b*tan(1/2*d*x + 1/2*c) + 3*A*b
^2*tan(1/2*d*x + 1/2*c) + 3*C*b^2*tan(1/2*d*x + 1/2*c))/(tan(1/2*d*x + 1/2*c)^2 - 1)^3)/d

________________________________________________________________________________________

Mupad [B]
time = 3.69, size = 209, normalized size = 2.03 \begin {gather*} \frac {2\,A\,a^2\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )}{d}+\frac {A\,b^2\,\sin \left (c+d\,x\right )}{d\,\cos \left (c+d\,x\right )}+\frac {C\,a^2\,\sin \left (c+d\,x\right )}{d\,\cos \left (c+d\,x\right )}+\frac {2\,C\,b^2\,\sin \left (c+d\,x\right )}{3\,d\,\cos \left (c+d\,x\right )}+\frac {C\,b^2\,\sin \left (c+d\,x\right )}{3\,d\,{\cos \left (c+d\,x\right )}^3}+\frac {C\,a\,b\,\sin \left (c+d\,x\right )}{d\,{\cos \left (c+d\,x\right )}^2}-\frac {A\,a\,b\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,1{}\mathrm {i}}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )\,4{}\mathrm {i}}{d}-\frac {C\,a\,b\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,1{}\mathrm {i}}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )\,2{}\mathrm {i}}{d} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((A + C/cos(c + d*x)^2)*(a + b/cos(c + d*x))^2,x)

[Out]

(2*A*a^2*atan(sin(c/2 + (d*x)/2)/cos(c/2 + (d*x)/2)))/d + (A*b^2*sin(c + d*x))/(d*cos(c + d*x)) + (C*a^2*sin(c
 + d*x))/(d*cos(c + d*x)) + (2*C*b^2*sin(c + d*x))/(3*d*cos(c + d*x)) + (C*b^2*sin(c + d*x))/(3*d*cos(c + d*x)
^3) - (A*a*b*atan((sin(c/2 + (d*x)/2)*1i)/cos(c/2 + (d*x)/2))*4i)/d - (C*a*b*atan((sin(c/2 + (d*x)/2)*1i)/cos(
c/2 + (d*x)/2))*2i)/d + (C*a*b*sin(c + d*x))/(d*cos(c + d*x)^2)

________________________________________________________________________________________